<?php
namespace addon\dashang;

use app\common\controller\AddonBase;

use addon\AddonInterface;

class Dashang extends AddonBase implements AddonInterface
{

   
    public $admin_list = array(
        'listKey' => array(
            'tid' => '打赏帖子',
            'score' => '打赏积分数',           
            'uid' => '打赏用户',
            'create_time' => '打赏时间',
        ),
        'model' => 'dashang',
        'order' => 'create_time asc',
        'field' => '*'
    );
    public $custom_adminlist = 'adminlist.html';
 /**
     * 插件安装
     */
    public function addonInstall()
    {
    	$arr=$this->addonInfo();
    	$this->getisHook('dashang', $arr['name'], $arr['describe']);
    	$this->installAddon($arr);
    	
        
        return [RESULT_SUCCESS, '安装成功'];
    }
    
    /**
     * 插件卸载
     */
    public function addonUninstall()
    {
    	$arr=$this->addonInfo();
    	$this->deleteHook('dashang');
    	$this->uninstallAddon($arr['name']);
     
        
        return [RESULT_SUCCESS, '卸载成功'];
    }
    
    /**
     * 插件基本信息
     */
    public function addonInfo()
    {
        
     return [
     		     'name' => 'Dashang',
        		 'title' => '帖子打赏', 
        		 'describe' => '帖子打赏',
        		 'author' => 'Zaker',
        		 'version' => '1.0',
     		     'has_adminlist' => '1'
               ];
    }


    //钩子方法
    public function Dashang($param)
    {
    	$info = $param['info'];
        $uid = is_login();
        $list = db('dashang')->where(['status'=>1,'sid'=>$info['id']])->order('create_time desc')->getList();
        foreach ($list as $k =>$v){
        	
        	
        	
        	
        	
        }
        
        
        $config = $this->getConfig('dashang');
        $this->assign('scorename',parse_config_attr(webconfig('scoretype_list'))[$config['scoretype']]);
   
        $this->addonTemplate('widget','index'); 
 
    }

  
}